package ccxz.biz.application.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class DateUtil {

    public static String dateTrans(String date) throws ParseException {
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");

        Date parse = sdf1.parse("20" + date);
        return sdf2.format(parse);
    }

    public static String format(LocalDateTime yesterday, String s) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(s);
        return yesterday.format(formatter);
    }
}
